import org.apache.commons.lang3.StringUtils;

/**
 * Created by PPurohit on 1/5/2015.
 */
public class BitwiseMain {

    public static void main(String[] args) {
        int a = Integer.parseInt("101010", 2);
        int b = Integer.parseInt("101011", 2);

        System.out.println(Integer.toString(a, 2) + " " + a);
        System.out.println(Integer.toString(b, 2) + " " + b);


        System.out.println(StringUtils.leftPad(Integer.toString(a & b, 2), 6, '0') + " " + (a & b));
        System.out.println(StringUtils.leftPad(Integer.toString(a | b, 2), 6, '0') + " " + (a | b));
        System.out.println(StringUtils.leftPad(Integer.toString(a ^ b, 2), 6, '0') + " " + (a ^ b));

    }
}
